package com.atguigu.stgy.admin.controller;

import com.atguigu.stgy.admin.service.AttrValueService;
import com.atguigu.stgy.model.entity.AttrKey;
import com.atguigu.stgy.model.entity.AttrValue;
import com.atguigu.stgy.admin.service.impl.AttrValueServiceImpl;
import com.atguigu.stgy.model.result.R;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//

/**
 * 房间基本属性值表(attr_value)表控制层
 *
 * @author xxxxx
 * http://localhost:8080/admin/attr/value/saveOrUpdate
 */
@RestController
@RequestMapping("/admin/attr")
public class AttrValueController {
    /**
     * 服务对象
     */
    @Resource
    private AttrValueService attrValueService;

    ///admin/attr/key/saveOrUpdate
    @Operation(summary = "新增/更新 房间基本信息属性值")
    @PostMapping("value/saveOrUpdate")
    public R saveOrUpdate(@RequestBody AttrValue attrValue){
        attrValueService.saveOrUpdate(attrValue);
        return R.ok();
    }
    ///attr/key/deleteById?attrKeyId=1795621399293964289
    @Operation(summary = "删除 房间基本信息属性值")
    @DeleteMapping("value/deleteById")
    public R deleteById(@RequestParam("id")Long id){
        attrValueService.removeById(id);
        return R.ok();
    }
}
